﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace BLL.SysManage
{
    public class T_PUB_ROLEMENU
    {
        private readonly DALL.SysManage.T_PUB_ROLEMENU dal = new DALL.SysManage.T_PUB_ROLEMENU();
        public T_PUB_ROLEMENU()
        {
        }

        public List<Model.SysManage.T_PUB_ROLEMENU> GetListByRole(string strROleID)
        {
            string strWhere = string.Format(" ROLE_ID='{0}'", strROleID);
            return GetListArray(strWhere);
        }

        /// <summary>
        /// 获得角色菜单
        /// </summary>
        /// <param name="strRoleID">角色ID</param>
        /// <param name="strPid">层级</param>
        /// <returns></returns>
        public DataSet GetRoleMenu(string strRoleID, string strPid)
        {
            StringBuilder strWhere = new StringBuilder();
            if (!string.IsNullOrEmpty(strRoleID))
            {
                strWhere.Append(string.Format(" and t.ROLE_ID='{0}'", strRoleID));
            }
            if (!string.IsNullOrEmpty(strPid))
            {
                strWhere.Append(string.Format(" and m.PARENT_ID='{0}'", strPid));
            }
            return dal.GetRoleMenu(strWhere.ToString());
        }

        public List<Model.SysManage.T_PUB_ROLEMENU> GetListArray(string strWhere)
        {
           return dal.GetListArray(strWhere);
        }
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Model.SysManage.T_PUB_ROLEMENU model)
        {
           return dal.Add(model);
        }
         /// <summary>
        /// 删除角色菜单
        /// </summary>
        /// <param name="roel"></param>
        /// <param name="ids"></param>
        public void DeleteRoleMenul(string roel, string ids)
        {
            dal.DeleteRoleMenul(roel, ids);
        }
          /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(int ID)
        {
            return dal.Delete(ID);
        }

          /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.SysManage.T_PUB_ROLEMENU GetModel(int ID)
        {
            return dal.GetModel(ID);
        }
    }
}
